<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('qnr_cls',function(Blueprint $table) {

            // 数据类型
            $table->engine = 'InnoDB';

            $table->comment('问卷分类表');

            $table->bigIncrements('id');
            $table->uuid('c_key')->nullable(false)->unique();
            $table->bigInteger('parent_id')->nullable()->default(0)->comment('父类');
            $table->string('order',125)->nullable()->default(0)->comment(' order 字段不是必须的，不设置也可以');
            $table->string('title',85)->unique()->nullable(false);
            $table->integer('sort_id')->unsigned()->default(1)->comment('排序');
            $table->text('content')->nullable();
            $table->string('depth',85)->nullable()->comment('定义depthColumn属性后，将会在数据表保存当前行的层级');
            $table->smallInteger('is_using')->nullable()->unsigned()->default(1)->comment('状态');
            $table->timestamps();

            $table->index('title');

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('qnr_cls');
    }
};
